package com.lcredu.factory;

import com.lcredu.bean.Monster;

import java.util.HashMap;

/**
 * @author 黎长容
 * @date 2025-07-12 17:56
 * 实例工厂
 */
public class MyInstanceFactory {
    public HashMap<String, Monster> hashMap;

    //完成初始化
    {
        hashMap = new HashMap<>();
        hashMap.put("monster03", new Monster(300, "牛魔王~", "芭蕉扇~"));
        hashMap.put("monster04", new Monster(400, "狐狸精~", "美人计~"));
    }

    public Monster getMonster(String monsterId) {
        return hashMap.get(monsterId);
    }
}
